package com.gxgeek.algorithm.t1;

import org.junit.Test;

/**
 * Created by gx on 2017/4/28.
 */
public class A {
    @Test//输出ASCII码  32~126
    public void ShowAscii() {
        String temp = "";
        for (int i = 32; i <= 126; i++) {
            temp = i < 100 ? ("0" + i) : ("" + i);
            System.out.print(temp + "=" + (char) i + " ");
            if ((i - 31) % 8 == 0) {
                System.out.print("\n");
            }
        }
    }


    @Test //输出 中文字的 unicode 码
    public void queryCoding(){
        String word = "假名字";
        System.out.println("输入的汉字为"+word);

        System.out.println("计算值为：");

        for (int i=0;i<word.length();i++){
            char ch = word.charAt(i);
            if (ch<19968|| ch>40869){
                continue; //不是 汉字跳过
            }
            System.out.println((int) ch+"  ");
        }

    }
}
